/* ============================================================
   Galerija — Vitrupes Pludmale (latvialainen teema)
   Moderni responsiivinen ruudukko + lightbox-katselu.
   Käyttää latviatyyli.css:n :root-muuttujia (varmuuskopiot mukana).
   ============================================================ */

.gallery-wrap { padding: 0; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.2rem;
}

.gallery {
  background: #fff;
  border: 1px solid var(--lv-line, #E6DCCB);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(43, 33, 28, .06);
  transition: transform .22s, box-shadow .22s;
}
.gallery:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 36px rgba(43, 33, 28, .16);
}
.gallery__media { overflow: hidden; }
.gallery__media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform .5s ease;
}
.gallery:hover .gallery__media img { transform: scale(1.06); }
.gallery .desc {
  padding: .8rem 1rem;
  text-align: center;
  font-size: .9rem;
  color: #4A3D34;
  background: var(--lv-linen, #F5EEE2);
  border-top: 2px solid var(--lv-amber, #C08A2E);
}

/* Upotukset: kartta + video */
.embed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.2rem;
}
.embed-grid .lv-embed iframe { width: 100%; min-height: 320px; }

/* Kun upotuksia on vain yksi (esim. pelkkä kartta) — keskitä ja rajaa leveys */
.embed-grid--single { grid-template-columns: minmax(0, 680px); justify-content: center; }
.embed-grid--single .lv-embed iframe { min-height: 380px; }

/* Lightbox-katseluikkuna (korvaa vanhan popup-ikkunan) */
.lightbox {
  position: fixed; inset: 0; z-index: 1080;
  display: none; align-items: center; justify-content: center;
  background: rgba(43, 20, 16, .88);
  padding: 24px; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 92vw; max-height: 84vh;
  border-radius: 10px;
  border: 3px solid var(--lv-amber, #C08A2E);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.lightbox__caption {
  position: absolute; bottom: 22px; left: 0; right: 0;
  text-align: center; color: #fff; font-size: 1rem; padding: 0 20px;
}
.lightbox__close {
  position: absolute; top: 14px; right: 26px;
  color: #fff; font-size: 2.4rem; line-height: 1;
  cursor: pointer; font-family: sans-serif; user-select: none;
}
.lightbox__close:hover { color: var(--lv-amber-light, #E4C77A); }

.clearfix:after { content: ""; display: table; clear: both; }

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

/* ---------- Gallerian sivutus (1 / 2) ---------- */
.gallery-nav {
  display: flex; justify-content: center; align-items: center;
  gap: .6rem; margin-top: clamp(2rem, 4vw, 3rem); flex-wrap: wrap;
}
.gallery-nav a, .gallery-nav span {
  font-family: 'Nunito Sans', sans-serif; font-weight: 700; font-size: .95rem;
  padding: .55rem 1.2rem; border-radius: 30px; text-decoration: none;
  border: 2px solid var(--lv-line, #E6DCCB); color: #4A3D34; background: #fff;
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.gallery-nav a:hover {
  background: var(--lv-red, #9E1B32); color: #fff;
  border-color: var(--lv-red, #9E1B32); transform: translateY(-2px);
}
.gallery-nav .is-current {
  background: var(--lv-red, #9E1B32); color: #fff; border-color: var(--lv-amber, #C08A2E);
}
