/* GALLERIA - La Casetta */
.gallery-block {
  margin-top: 4.5rem;
}

.gallery-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 2rem;
  margin-bottom: 1.4rem;
}

.gallery-heading h2 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.1rem, 4vw, 3.1rem);
  line-height: 1.05;
  color: var(--green-dark);
}

.gallery-heading > p {
  max-width: 440px;
  margin: 0 0 0.25rem;
  color: var(--text-soft);
}

.gallery-shell {
  position: relative;
}

.gallery-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 0.2rem 0.1rem 0.8rem;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

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

.gallery-item {
  flex: 0 0 calc((100% - 2rem) / 3);
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #ddd;
  cursor: zoom-in;
  scroll-snap-align: start;
  box-shadow: 0 10px 24px rgba(22, 56, 29, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(22, 56, 29, 0.14);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  background: rgba(22, 56, 29, 0.9);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.gallery-shell:hover .gallery-arrow,
.gallery-shell:focus-within .gallery-arrow {
  opacity: 1;
}

.gallery-arrow:hover {
  background: var(--green-dark);
  transform: translateY(-50%) scale(1.05);
}

.gallery-arrow-left { left: -18px; }
.gallery-arrow-right { right: -18px; }

/* LIGHTBOX */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox.open {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(7, 16, 10, 0.9);
  cursor: zoom-out;
}

.lightbox-content {
  position: relative;
  z-index: 1;
  width: min(94vw, 1300px);
  height: min(90vh, 900px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-figure img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.5);
}

.lightbox-figure figcaption {
  margin-top: 0.75rem;
  color: rgba(255,255,255,0.9);
  text-align: center;
  font-size: 0.98rem;
}

.lightbox-close,
.lightbox-arrow {
  position: absolute;
  z-index: 4;
  border: 0;
  color: #fff;
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(5px);
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.lightbox-close {
  top: 0;
  right: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
}

.lightbox-arrow {
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font-size: 2.4rem;
  line-height: 1;
  opacity: 0;
}

.lightbox-content:hover .lightbox-arrow,
.lightbox-content:focus-within .lightbox-arrow {
  opacity: 1;
}

.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }

.lightbox-close:hover,
.lightbox-arrow:hover {
  background: rgba(40, 82, 50, 0.92);
}

.lightbox-counter {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.75);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

body.lightbox-open {
  overflow: hidden;
}

@media (max-width: 980px) {
  .gallery-heading {
    align-items: start;
    flex-direction: column;
    gap: 0.7rem;
  }

  .gallery-item {
    flex-basis: calc((100% - 1rem) / 2);
  }

  .gallery-arrow {
    opacity: 1;
  }

  .gallery-arrow-left { left: 8px; }
  .gallery-arrow-right { right: 8px; }

  .lightbox-arrow {
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .gallery-block {
    margin-top: 3.25rem;
  }

  .gallery-item {
    flex-basis: 82%;
  }

  .gallery-arrow {
    width: 42px;
    height: 42px;
  }

  .lightbox {
    padding: 1rem;
  }

  .lightbox-content {
    width: 100%;
    height: 92vh;
  }

  .lightbox-figure img {
    max-height: 76vh;
  }

  .lightbox-arrow {
    width: 46px;
    height: 46px;
    font-size: 2rem;
  }

  .lightbox-prev { left: 0; }
  .lightbox-next { right: 0; }
}

@media (hover: none) {
  .gallery-arrow,
  .lightbox-arrow {
    opacity: 1;
  }
}
