/* Gallery Section */
.gallery {
  padding: var(--pad-lg) var(--pad-lg);
  text-align: center;
}

.gallery h2 {
  font-size: clamp(36px, 5vw, 48px);
  font-weight: 900;
  margin-bottom: var(--gap);
  color: var(--text);
  letter-spacing: -0.02em;
}

.gallery-desc {
  font-size: 18px;
  color: var(--muted);
  margin-bottom: var(--gap-lg);
}

.gallery-grid {
  margin-top: var(--gap);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* Slideshow */
.gallery-slideshow {
  position: relative;
  border-radius: var(--r3);
  overflow: hidden;
  border: 2px solid var(--line);
  background: var(--panel2);
  box-shadow: var(--shadow-lg);
  transform-origin: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-slideshow:hover {
  transform: scale(1.02);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.gallery-slide-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  cursor: pointer;
  overflow: hidden;
  padding: var(--pad-sm);
}

.gallery-slide-track {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  height: 100%;
}

.gallery-slide {
  position: relative;
  flex: 0 0 72%;
  max-width: 72%;
  height: 100%;
  opacity: 0.4;
  filter: blur(2px);
  transform: scale(0.92);
  transition: opacity 0.35s ease, filter 0.35s ease, transform 0.35s ease;
  pointer-events: auto;
  border-radius: var(--r2);
  overflow: hidden;
}

.gallery-slide.active {
  opacity: 1;
  filter: none;
  transform: scale(1);
  z-index: 1;
}

.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-slideshow-prev,
.gallery-slideshow-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 48px;
  height: 48px;
  border: 2px solid var(--line);
  background: rgba(18, 20, 24, 0.85);
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.gallery-slideshow-prev {
  left: var(--pad);
}

.gallery-slideshow-next {
  right: var(--pad);
}

.gallery-slideshow-prev:hover,
.gallery-slideshow-next:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-50%) scale(1.05);
}

.gallery-slideshow-dots {
  display: none;
}

.gallery-slideshow-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--line2);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

.gallery-slideshow-dot:hover {
  border-color: var(--primary);
  background: rgba(197, 48, 48, 0.3);
}

.gallery-slideshow-dot.active {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.2);
}

.gallery-slideshow-caption {
  display: none;
}

/* Gallery Modal */
.gallery-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad-lg);
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
}

.gallery-modal[hidden] {
  display: none !important;
}

.gallery-modal.open {
  opacity: 1;
}

.gallery-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out;
}

.gallery-modal.open .gallery-modal-content {
  opacity: 1;
  transform: translateY(0);
}

.gallery-modal-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: var(--panel);
  border: 2px solid var(--line);
  color: var(--text);
  font-size: 32px;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r);
  transition: var(--transition);
  z-index: 10;
}

.gallery-modal-close:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.gallery-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--panel);
  border: 2px solid var(--line);
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r);
  transition: var(--transition);
  z-index: 10;
}

.gallery-modal-prev {
  left: -60px;
}

.gallery-modal-next {
  right: -60px;
}

.gallery-modal-nav:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.gallery-modal-image {
  width: 100%;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--gap-lg);
}

.gallery-modal-image img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--r2);
  box-shadow: var(--shadow-lg);
}

.gallery-modal-info {
  text-align: center;
  color: var(--text);
}

.gallery-modal-info h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: var(--gap-sm);
}

.gallery-modal-date {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 768px) {
  .gallery-slide-stage {
    aspect-ratio: 4 / 3;
  }

  .gallery-slideshow-prev,
  .gallery-slideshow-next {
    width: 40px;
    height: 40px;
    font-size: 20px;
    left: var(--gap-sm);
  }

  .gallery-slideshow-next {
    right: var(--gap-sm);
  }

  .gallery-modal-nav {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .gallery-modal-prev {
    left: var(--pad);
  }

  .gallery-modal-next {
    right: var(--pad);
  }

  .gallery-modal-close {
    top: var(--pad);
    right: var(--pad);
  }
}
