/* Thumbnail strip */

.gallery {
  position: relative;
  margin-top: 2rem;
}

.gallery-track {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.75rem 0.25rem 1.25rem;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-item {
  flex: 0 0 auto;
  width: 400px;
  height: 300px;
  border-radius: 14px;
  overflow: hidden;
  scroll-snap-align: start;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  background: #edf2f9;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

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

.gallery-item:focus-visible {
  outline: 3px solid #E3A476;
  outline-offset: 3px;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #124838;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transform: translateY(-50%);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.gallery-nav:hover {
  background: #124838;
  color: #fff;
}

.gallery-nav:disabled {
  opacity: 0;
  pointer-events: none;
}

.gallery-prev {
  left: -10px;
}

.gallery-next {
  right: -10px;
}

@media (max-width: 768px) {
  .gallery-item {
    width: 300px;
    height: 225px;
  }
}

@media (max-width: 576px) {
  .gallery-item {
    width: 250px;
    height: 187px;
  }

  .gallery-nav {
    display: none;
  }
}

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: rgba(18, 24, 22, 0.94);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 1rem 1.25rem;
}

.lightbox-counter {
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  opacity: 0.8;
}

.lightbox-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover {
  background: #E3A476;
  border-color: #E3A476;
  transform: rotate(90deg);
}

.lightbox-stage {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 5rem;
  touch-action: pan-y;
}

.lightbox-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transform: scale(0.98);
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.lightbox-image.is-loaded {
  opacity: 1;
  transform: scale(1);
}

.lightbox-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.5rem;
  height: 2.5rem;
  margin: -1.25rem 0 0 -1.25rem;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #E3A476;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: lightbox-spin 0.8s linear infinite;
  transition: opacity 0.2s ease;
}

.lightbox.is-loading .lightbox-spinner {
  opacity: 1;
}

@keyframes lightbox-spin {
  to {
    transform: rotate(360deg);
  }
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.25rem;
  transform: translateY(-50%);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.lightbox-nav:hover {
  background: #E3A476;
}

.lightbox-prev {
  left: 1.25rem;
}

.lightbox-next {
  right: 1.25rem;
}

.lightbox-close:focus-visible,
.lightbox-nav:focus-visible,
.lightbox-thumb:focus-visible {
  outline: 2px solid #E3A476;
  outline-offset: 2px;
}

.lightbox-thumbs {
  display: flex;
  flex-shrink: 0;
  gap: 0.5rem;
  justify-content: safe center;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 1rem 1.25rem 1.25rem;
}

.lightbox-thumbs::-webkit-scrollbar {
  display: none;
}

.lightbox-thumb {
  flex: 0 0 auto;
  width: 72px;
  height: 54px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: none;
  opacity: 0.45;
  cursor: pointer;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

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

.lightbox-thumb:hover {
  opacity: 0.8;
}

.lightbox-thumb.is-active {
  border-color: #E3A476;
  opacity: 1;
}

body.lightbox-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .lightbox-stage {
    padding: 0 0.75rem;
  }

  .lightbox-nav {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.45);
  }

  .lightbox-prev {
    left: 1rem;
  }

  .lightbox-next {
    right: 1rem;
  }

  .lightbox-thumb {
    width: 56px;
    height: 42px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .lightbox-bar {
    padding: 0.5rem 1rem;
  }

  .lightbox-thumbs {
    display: none;
  }

  .lightbox-stage {
    padding-bottom: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox-image,
  .gallery-item img {
    transition: none;
  }
}
