/*--------------------------------------------------------------
# Galleria screenshot: righe scorrevoli orizzontali + visualizzatore
--------------------------------------------------------------*/
.gallery {
  --rail-gutter: clamp(16px, 4vw, 56px);
  --tile-w: clamp(220px, 30vw, 360px);
  background: #141414;
  color: #e5e5e5;
  padding: 40px 0 56px;
}

.gallery-intro {
  padding: 0 var(--rail-gutter) 8px;
}

.gallery-intro h1 {
  color: #fff;
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 6px;
}

.gallery-intro p {
  color: #b3b3b3;
  margin: 0;
}

.rail {
  margin-top: 28px;
}

.rail-title {
  color: #fff;
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 600;
  margin: 0 var(--rail-gutter) 10px;
}

.rail-viewport {
  position: relative;
}

.rail-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--rail-gutter);
  padding: 12px var(--rail-gutter) 16px;
  scrollbar-width: none;
}

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

.shot {
  position: relative;
  flex: 0 0 var(--tile-w);
  aspect-ratio: 16 / 10;
  border-radius: 6px;
  overflow: hidden;
  background: #2a2a2a;
  scroll-snap-align: start;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.shot-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 24px 10px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shot:focus-visible {
  outline: 3px solid #fd680e;
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .shot:hover {
    transform: scale(1.06);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
    z-index: 2;
  }
}

/* Frecce di scorrimento: solo con il mouse, sui touch si scorre col dito */
.rail-arrow {
  position: absolute;
  top: 12px;
  bottom: 16px;
  z-index: 3;
  width: var(--rail-gutter);
  min-width: 40px;
  border: 0;
  color: #fff;
  font-size: 40px;
  background: rgba(20, 20, 20, 0.6);
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
  cursor: pointer;
}

.rail-prev {
  left: 0;
}

.rail-next {
  right: 0;
}

.rail-viewport:hover .rail-arrow,
.rail-arrow:focus-visible {
  opacity: 1;
}

.rail-arrow:hover {
  background: rgba(20, 20, 20, 0.85);
}

@media (hover: none), (pointer: coarse) {
  .rail-arrow {
    display: none;
  }
}

.gallery-cta {
  text-align: center;
  margin-top: 40px;
  padding: 0 16px;
}

.gallery-cta p {
  color: #fff;
  font-size: 18px;
}

.gallery-btn {
  display: inline-block;
  margin: 6px;
  padding: 10px 32px;
  border-radius: 50px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #fff;
  background: #fd680e;
}

.gallery-btn:hover,
.gallery-btn:focus-visible {
  color: #fff;
  background: #fd8841;
}

.gallery-btn-secondary {
  background: #1769c2;
}

.gallery-btn-secondary:hover,
.gallery-btn-secondary:focus-visible {
  background: #2f86e4;
}

/*--------------------------------------------------------------
# Visualizzatore a schermo intero
--------------------------------------------------------------*/
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  flex-direction: column;
}

.lightbox[hidden] {
  display: none;
}

.lb-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
  cursor: zoom-in;
}

.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.2s ease;
}

/* Ingrandito: l'immagine supera lo schermo e si esplora scorrendo */
.lb-stage.zoomed {
  display: block;
  overflow: auto;
  touch-action: auto;
  cursor: zoom-out;
}

.lb-stage.zoomed img {
  max-width: none;
  max-height: none;
}

.lb-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  color: #e5e5e5;
  font-size: 15px;
}

.lb-counter {
  color: #b3b3b3;
  white-space: nowrap;
}

.lb-btn {
  position: absolute;
  border: 0;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 34px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.lb-btn:hover,
.lb-btn:focus-visible {
  background: rgba(255, 255, 255, 0.28);
}

.lb-close {
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
}

.lb-prev,
.lb-next {
  top: 50%;
  transform: translateY(-50%);
}

.lb-prev {
  left: 12px;
}

.lb-next {
  right: 12px;
}

@media (pointer: coarse) {
  .lb-btn {
    width: 40px;
    height: 40px;
    font-size: 28px;
  }
}

body.lb-open {
  overflow: hidden;
}
