/* Homepage gallery: horizontal strip + lightbox (scoped to #gallery) */

#gallery.home-gallery {
  position: relative;
  /* Light premium stack: testimonials #f8f9fa → ~20% darken at deepest stop + soft brand radials */
  background-color: #d5d9e0;
  background-image:
    radial-gradient(125% 90% at 50% -30%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 50%),
    radial-gradient(85% 55% at 100% 42%, rgba(37, 94, 80, 0.055) 0%, transparent 52%),
    radial-gradient(65% 48% at 0% 95%, rgba(212, 188, 120, 0.065) 0%, transparent 48%),
    linear-gradient(
      168deg,
      #f8f9fa 0%,
      #eef0f4 26%,
      #e2e6ed 55%,
      #c6c7c8 100%
    );
  color: var(--text, #2c3e50);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

#gallery.home-gallery .container {
  position: relative;
  z-index: 1;
}

#gallery .home-gallery-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #6c757d;
  margin-top: 1.5rem;
}

#gallery .home-gallery-wrap {
  position: relative;
  margin-top: 2rem;
  width: 100%;
}

#gallery .home-gallery-scroller {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 0 48px;
  box-sizing: border-box;
}

#gallery .home-gallery-scroller::-webkit-scrollbar {
  display: none;
}

#gallery .home-gallery-track {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 1.25rem;
  padding: 0.5rem 0 1rem;
  position: relative;
}

#gallery .home-gallery-card {
  flex: 0 0 min(85vw, 400px);
  width: min(85vw, 400px);
  scroll-snap-align: start;
  border-radius: 16px;
  overflow: visible;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  background: transparent;
  font: inherit;
  border: none;
  padding: 0;
  text-align: left;
}

#gallery .home-gallery-card-media {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: #dce0e6;
  transition: opacity 0.35s ease, filter 0.35s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

#gallery .home-gallery-card:not(.is-focused) .home-gallery-card-media {
  opacity: 0.52;
  filter: brightness(0.62);
}

#gallery .home-gallery-card.is-focused .home-gallery-card-media {
  opacity: 1;
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  #gallery .home-gallery-card {
    transition: none;
  }

  #gallery .home-gallery-card-media {
    transition: none;
  }
}

#gallery .home-gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: none;
}

#gallery .home-gallery-card.is-focused:hover {
  transform: translateY(-4px);
}

#gallery .home-gallery-card.is-focused:hover .home-gallery-card-media {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

#gallery .home-gallery-card:focus-visible {
  outline: 2px solid var(--primary, #255e50);
  outline-offset: 3px;
}

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

#gallery .home-gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text, #333);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  opacity: 0.95;
  padding: 0;
}

#gallery .home-gallery-arrow.visible {
  display: flex;
}

#gallery .home-gallery-arrow:hover:not(:disabled) {
  background: #fff;
  opacity: 1;
  border-color: var(--primary, #255e50);
  color: var(--primary, #255e50);
}

#gallery .home-gallery-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#gallery .home-gallery-arrow-left {
  left: 4px;
}

#gallery .home-gallery-arrow-right {
  right: 4px;
}

/* Lightbox — must be moved under document.body in JS (#gallery has transform from data-reveal) */
.home-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
  display: block;
}

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

.home-gallery-lightbox-scrim {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000;
  cursor: pointer;
}

.home-gallery-lightbox-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 6;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-gallery-lightbox-close:hover {
  background: rgba(0, 0, 0, 0.6);
}

.home-gallery-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.home-gallery-lightbox-nav:hover {
  background: rgba(0, 0, 0, 0.65);
  border-color: rgba(255, 255, 255, 0.45);
}

.home-gallery-lightbox-nav:active {
  transform: translateY(-50%) scale(0.96);
}

.home-gallery-lightbox-nav-prev {
  left: max(10px, env(safe-area-inset-left));
}

.home-gallery-lightbox-nav-next {
  right: max(10px, env(safe-area-inset-right));
}

.home-gallery-lightbox-nav[hidden] {
  display: none !important;
}

.home-gallery-lightbox-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
  cursor: pointer;
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  #gallery .home-gallery-arrow {
    transition: none;
  }
}
