/* Gallery-specific styles (extracted from the demo's inline <style>). */

.gallery-title { margin-bottom: 48px; }

.controls { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 40px; gap: 12px; }
.filter-group {
  display: flex; flex-wrap: wrap; gap: 6px;
  max-height: 44px; overflow: hidden;
  transition: max-height 0.3s ease;
}
.filter-group.is-expanded { max-height: 2000px; }
.filter-btn {
  background: transparent; border: 1px solid #a0a0a0; color: #e0e0e0;
  font-family: 'Fira Sans', sans-serif; font-size: 0.82rem; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 7px 18px; border-radius: 20px; cursor: pointer; transition: all 0.25s ease;
  white-space: nowrap;
}
.filter-btn:hover { background: rgba(255, 255, 255, 0.12); border-color: #c0c0c0; }
.filter-btn.is-active { background: #ffffff; color: #333333; border-color: #ffffff; }
.filter-toggle {
  background: transparent; border: none; color: #d0d0d0;
  font-family: 'Fira Sans', sans-serif; font-size: 0.78rem; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 0; cursor: pointer; text-decoration: underline;
}
.filter-toggle:hover { color: #fff; }

.grid { width: 100%; margin: 0 auto; }
.grid-sizer, .grid-item { width: calc(33.333% - 16px); }
.gutter-sizer { width: 24px; }
.grid-item { margin-bottom: 36px; }
.grid-item-link { display: block; position: relative; }

.grid-item img { display: block; width: 100%; height: auto; cursor: pointer; transition: opacity 0.5s ease; background: #6e6e6e; }
.grid-item img.is-loading { opacity: 0; }
.grid-item img:hover { opacity: 0.88; }

/* Tasto play sulle foto che hanno un video collegato */
.play-badge {
  position: absolute; top: 50%; left: 50%;
  width: 64px; height: 64px; margin: -32px 0 0 -32px;
  border-radius: 50%;
  background: rgba(20, 19, 15, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.85);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  transition: background 0.25s ease, transform 0.25s ease;
}
.grid-item-link:hover .play-badge { background: rgba(20, 19, 15, 0.8); transform: scale(1.06); }
.play-badge svg { width: 34px; height: 34px; fill: #fff; }

.item-info { display: flex; justify-content: start; margin-top: 14px; }
.item-info-inner { text-align: left; max-width: 100%; width: 100%; }
.item-title {
  font-weight: 400; font-size: 1.05rem; color: #f0f0f0; margin-bottom: 8px; line-height: 1.35;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  overflow: hidden; cursor: pointer;
}
.item-title:hover { color: #fff; }

.item-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  display: inline-block; background: rgba(255, 255, 255, 0.15); color: #d0d0d0;
  font-size: 0.7rem; font-weight: 400; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 12px; line-height: 1.6;
  text-decoration: none;
}
a.tag:hover { color: #fff; background: rgba(255,255,255,0.22); }

/* Single foto */
.single-foto { margin: 0 0 32px; max-width: 1100px; }
.single-foto img { display: block; width: 100%; height: auto; }
.single-foto-caption {
  margin-top: 16px;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.2rem; line-height: 1.5; color: #e5e1d0;
  font-style: italic;
  max-width: 760px;
}

/* Lightbox */
.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(20, 19, 15, 0.92); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity 0.35s ease, visibility 0.35s ease;
  cursor: zoom-out;
  padding-right: 320px; padding-left: 20px;
}
.lightbox-overlay.is-visible { opacity: 1; visibility: visible; }

.lightbox-stage {
  position: relative;
  display: inline-block;
  max-width: calc(100vw - 360px);
  max-height: 88vh;
}
.lightbox-overlay img {
  display: block;
  max-width: calc(100vw - 360px); max-height: 88vh;
  object-fit: contain; border-radius: 2px;
  opacity: 0; transform: scale(0.96);
  transition: opacity 0.3s ease 0.05s, transform 0.3s ease 0.05s;
}
.lightbox-overlay.is-visible img { opacity: 1; transform: scale(1); }

.lightbox-video {
  width: min(calc(100vw - 360px), calc(88vh * 16 / 9), 1280px);
  aspect-ratio: 16 / 9;
  background: #000; border-radius: 2px;
  opacity: 0; transition: opacity 0.3s ease 0.05s;
}
.lightbox-overlay.is-visible .lightbox-video { opacity: 1; }
.lightbox-video iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 2px; }

.lightbox-caption {
  position: absolute;
  top: auto; bottom: 0;
  left: 100%;
  margin-left: 20px;
  width: 280px; max-width: 26vw;
  cursor: default;
  opacity: 0; transition: opacity 0.3s ease 0.1s;
  color: #e8e4d4;
}
.lightbox-overlay.is-visible .lightbox-caption { opacity: 1; }
.lightbox-caption .lb-title { font-size: 0.92rem; line-height: 1.45; margin-bottom: 10px; color: #f0ecd8; }
.lightbox-caption .lb-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.lightbox-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e8e4d4; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease;
}
.lightbox-nav:hover { background: rgba(0, 0, 0, 0.7); color: #fff; }
.lightbox-nav.prev { left: 24px; }
.lightbox-nav.next { right: 24px; }
.lightbox-nav svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.lightbox-nav:disabled { opacity: 0.3; cursor: default; }

.lightbox-close {
  position: absolute; top: 24px; right: 28px; width: 40px; height: 40px;
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-close svg { width: 22px; height: 22px; stroke: #d4cfb8; stroke-width: 2; transition: stroke 0.2s ease; }
.lightbox-close:hover svg { stroke: #fff; }

@media (max-width: 900px) {
  .grid-sizer, .grid-item { width: calc(50% - 12px); }
  .gutter-sizer { width: 24px; }
  .lightbox-overlay { padding-right: 20px; padding-left: 20px; flex-direction: column; }
  .lightbox-stage { max-width: 92vw; max-height: 65vh; }
  .lightbox-overlay img { max-width: 92vw; max-height: 65vh; }
  .lightbox-video { width: min(92vw, calc(65vh * 16 / 9)); }
  .lightbox-caption {
    position: static; width: 100%; max-width: 92vw;
    margin-left: 0; margin-top: 14px;
  }
  .lightbox-nav.prev { left: 8px; }
  .lightbox-nav.next { right: 8px; }
}

@media (max-width: 560px) {
  .grid-sizer, .grid-item { width: 100%; }
  .gutter-sizer { width: 0px; }
}
