.gallery-section {
  padding: var(--space-16) 0;
}

.gallery-header {
  text-align: center;
  margin-bottom: var(--space-12);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.gallery-title {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-4);
}

@media (max-width: 768px) {
  .gallery-title {
    font-size: var(--text-3xl);
  }
}

.gallery-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
}

.gallery-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  margin-bottom: var(--space-10);
}

.filter-btn {
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  text-decoration: none;
}

.filter-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
}

.filter-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
  grid-auto-flow: dense;
  grid-auto-rows: 10px;
}

@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 1fr;
  }
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-secondary);
  break-inside: avoid;
}

.gallery-item--featured {
  grid-column: span 2;
  grid-row: span 2;
}

@media (max-width: 1024px) {
  .gallery-item--featured {
    grid-column: span 1;
    grid-row: span 1;
  }
}

@media (max-width: 640px) {
  .gallery-item--featured {
    grid-column: span 1;
    grid-row: span 1;
  }
}

.gallery-item.aspect-square {
  grid-row: span 10;
}

.gallery-item.aspect-portrait {
  grid-row: span 15;
}

.gallery-item.aspect-landscape {
  grid-row: span 8;
}

@media (max-width: 640px) {
  .gallery-item.aspect-square,
  .gallery-item.aspect-portrait,
  .gallery-item.aspect-landscape {
    grid-row: span 1;
    aspect-ratio: 4/3;
  }

  .gallery-item.aspect-square {
    aspect-ratio: 1/1;
  }
}

.gallery-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow) ease;
}

.gallery-item:hover .gallery-image {
  transform: scale(1.05);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(27, 79, 114, 0.95) 0%,
    rgba(27, 79, 114, 0.6) 50%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-5);
}

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

.gallery-category {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.gallery-caption {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--color-white);
  line-height: var(--leading-snug);
}

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-index-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.95);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.lightbox.open .lightbox-content {
  transform: scale(1);
}

.lightbox-image {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2xl);
}

.lightbox-close {
  position: absolute;
  top: -60px;
  right: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-white);
  text-decoration: none;
}

.lightbox-close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.lightbox-close svg {
  width: 24px;
  height: 24px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-white);
  text-decoration: none;
}

.lightbox-nav:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.lightbox-nav svg {
  width: 24px;
  height: 24px;
}

.lightbox-prev {
  left: -80px;
}

.lightbox-next {
  right: -80px;
}

@media (max-width: 1024px) {
  .lightbox-prev {
    left: var(--space-4);
  }

  .lightbox-next {
    right: var(--space-4);
  }
}

.lightbox-caption {
  position: absolute;
  bottom: -80px;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--color-white);
  padding: var(--space-3);
}

.lightbox-caption-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
}

.lightbox-caption-desc {
  font-size: var(--text-sm);
  color: var(--color-gray-300);
}

.lightbox-counter {
  position: absolute;
  top: -50px;
  left: 0;
  color: var(--color-gray-300);
  font-size: var(--text-sm);
}

@media (max-width: 768px) {
  .lightbox-close {
    top: -50px;
    right: var(--space-4);
  }

  .lightbox-caption {
    bottom: -70px;
  }

  .lightbox-counter {
    top: -40px;
  }

  .lightbox-nav {
    width: 44px;
    height: 44px;
  }
}

.gallery-cta {
  text-align: center;
  margin-top: var(--space-12);
  padding-top: var(--space-12);
  border-top: 1px solid var(--color-gray-200);
}

.gallery-empty {
  text-align: center;
  padding: var(--space-16) var(--space-4);
  color: var(--text-tertiary);
}

.gallery-empty svg {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  color: var(--color-gray-400);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gallery-item {
  animation: fadeIn var(--transition-normal) ease-out;
}

.gallery-item:nth-child(1) { animation-delay: 0ms; }
.gallery-item:nth-child(2) { animation-delay: 50ms; }
.gallery-item:nth-child(3) { animation-delay: 100ms; }
.gallery-item:nth-child(4) { animation-delay: 150ms; }
.gallery-item:nth-child(5) { animation-delay: 200ms; }
.gallery-item:nth-child(6) { animation-delay: 250ms; }
.gallery-item:nth-child(7) { animation-delay: 300ms; }
.gallery-item:nth-child(8) { animation-delay: 350ms; }
.gallery-item:nth-child(9) { animation-delay: 400ms; }
.gallery-item:nth-child(10) { animation-delay: 450ms; }
.gallery-item:nth-child(11) { animation-delay: 500ms; }
.gallery-item:nth-child(12) { animation-delay: 550ms; }

@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .lightbox,
  .lightbox-content,
  .lightbox-image,
  .lightbox-nav,
  .lightbox-close {
    animation: none !important;
    transition: none !important;
  }

  .gallery-item {
    opacity: 1;
  }

  .lightbox {
    opacity: 0;
    visibility: hidden;
  }

  .lightbox.open {
    opacity: 1;
    visibility: visible;
  }
}