/* ============================================================
   GALLERY COMPONENT — styles
   ============================================================
   Usa CSS variables del template ospite per integrarsi col tema:
   --bg, --ink, --accent, --hairline (fallback se mancano).
   ============================================================ */

/* ---- Gallery container ---- */
.lg-gallery {
  position: relative;
  width: 100%;
  overflow: hidden;
}
.lg-gallery .lg-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform;
}
.lg-gallery .lg-slide {
  flex: 0 0 100%;
  min-width: 100%;
  position: relative;
  cursor: zoom-in;
  margin: 0;
  background: var(--bg, #0E0C0A);
}
.lg-gallery .lg-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 16 / 10;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.lg-gallery .lg-slide:hover img {
  transform: scale(1.02);
}
.lg-gallery .lg-slide figcaption {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  background: rgba(15, 12, 10, 0.78);
  color: #F1ECE2;
  padding: 0.5rem 0.85rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
  border-radius: 2px;
}

/* ---- Arrows ---- */
.lg-gallery .lg-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(15, 12, 10, 0.65);
  color: #F1ECE2;
  border: 1px solid rgba(241, 236, 226, 0.18);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  backdrop-filter: blur(10px);
  transition: background 0.18s, transform 0.18s, opacity 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: serif;
}
.lg-gallery .lg-arrow:hover:not(:disabled) {
  background: var(--accent, #C66E45);
  color: #0E0C0A;
  transform: translateY(-50%) scale(1.06);
}
.lg-gallery .lg-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.lg-gallery .lg-arrow.lg-prev { left: 1rem; }
.lg-gallery .lg-arrow.lg-next { right: 1rem; }

/* ---- Dots ---- */
.lg-gallery .lg-dots {
  position: absolute;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  display: flex;
  gap: 0.45rem;
  z-index: 4;
}
.lg-gallery .lg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(241, 236, 226, 0.45);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
}
.lg-gallery .lg-dot:hover {
  background: rgba(241, 236, 226, 0.8);
}
.lg-gallery .lg-dot.active {
  background: var(--accent, #C66E45);
  transform: scale(1.35);
}

/* ---- Lightbox ---- */
.lg-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.lg-lightbox.open {
  display: flex;
  animation: lgFadeIn 0.35s ease-out;
}
@keyframes lgFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lg-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 4, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: zoom-out;
}

.lg-lightbox-inner {
  position: relative;
  z-index: 1;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lgZoomIn 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes lgZoomIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.lg-lightbox-close {
  position: absolute;
  top: -3rem;
  right: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(241, 236, 226, 0.15);
  border: 1px solid rgba(241, 236, 226, 0.25);
  color: #F1ECE2;
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 10;
  transition: background 0.18s;
  font-family: sans-serif;
  line-height: 1;
  padding: 0;
}
.lg-lightbox-close:hover {
  background: rgba(241, 236, 226, 0.30);
}

.lg-lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(241, 236, 226, 0.15);
  border: 1px solid rgba(241, 236, 226, 0.25);
  color: #F1ECE2;
  font-size: 1.8rem;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(10px);
  transition: background 0.18s, transform 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: serif;
}
.lg-lightbox-arrow:hover {
  background: rgba(241, 236, 226, 0.30);
  transform: translateY(-50%) scale(1.06);
}
.lg-lightbox-arrow.lg-prev { left: -4rem; }
.lg-lightbox-arrow.lg-next { right: -4rem; }
@media (max-width: 800px) {
  .lg-lightbox-arrow.lg-prev { left: 0.5rem; }
  .lg-lightbox-arrow.lg-next { right: 0.5rem; }
}

.lg-lightbox-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 100%;
  max-height: 100%;
}
.lg-lightbox-img {
  max-width: 92vw;
  max-height: 80vh;
  object-fit: contain;
  display: block;
  border-radius: 2px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
  transition: opacity 0.3s;
}
.lg-lightbox-caption {
  color: #F1ECE2;
  font-family: ui-serif, Georgia, serif;
  font-size: 1rem;
  font-style: italic;
  text-align: center;
  max-width: 60ch;
  margin: 0;
}
.lg-lightbox-counter {
  color: rgba(241, 236, 226, 0.6);
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0;
}

/* ---- Reduce motion ---- */
@media (prefers-reduced-motion: reduce) {
  .lg-gallery .lg-track,
  .lg-gallery .lg-slide img,
  .lg-lightbox-img,
  .lg-lightbox.open,
  .lg-lightbox-inner {
    transition: none;
    animation: none;
  }
}
