/* ================================================
   nam-gallery.css — gallerie fotografiche
   ================================================ */

.gallery-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 40px 80px;
}

/* ── Header ── */
.gallery-header {
  padding-bottom: 20px;
  margin-bottom: 40px;
  border-bottom: 2px solid var(--red-dark);
}

.gallery-label {
  font-size: .58rem;
  letter-spacing: .4em;
  color: var(--red);
  margin-bottom: 10px;
  font-family: 'Share Tech Mono', monospace;
}

.gallery-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: .15em;
  color: var(--white);
  margin: 0 0 8px;
}

.gallery-back {
  display: inline-block;
  font-family: 'Share Tech Mono', monospace;
  font-size: .65rem;
  letter-spacing: .2em;
  color: var(--grey);
  text-decoration: none;
  text-transform: uppercase;
  margin-bottom: 12px;
  transition: color .15s;
}
.gallery-back:hover { color: var(--red); }

.gallery-empty {
  font-family: 'Share Tech Mono', monospace;
  font-size: .8rem;
  color: var(--grey);
  padding: 40px 0;
}

/* ── Griglia gallerie (index) ── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.gallery-card {
  display: block;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--grey-dark);
  border-left: 3px solid var(--red-dark);
  transition: border-color .2s, transform .15s;
  overflow: hidden;
}

.gallery-card:hover {
  border-left-color: var(--red);
  transform: translateY(-3px);
}

.gallery-card-img {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #0a0a0a;
}

.gallery-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(20%);
  transition: filter .3s, transform .3s;
}

.gallery-card:hover .gallery-card-img img {
  filter: grayscale(0%);
  transform: scale(1.03);
}

.gallery-card-noimg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: .65rem;
  letter-spacing: .3em;
  color: rgba(255,255,255,.15);
}

.gallery-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 50%);
  display: flex;
  align-items: flex-end;
  padding: 10px 12px;
  opacity: 0;
  transition: opacity .2s;
}

.gallery-card:hover .gallery-card-overlay { opacity: 1; }

.gallery-card-count {
  font-family: 'Share Tech Mono', monospace;
  font-size: .62rem;
  color: rgba(255,255,255,.7);
  letter-spacing: .15em;
}

.gallery-card-info {
  padding: 12px 14px;
}

.gallery-card-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: .82rem;
  color: rgba(255,255,255,.75);
  letter-spacing: .08em;
}

/* ── Griglia foto singola galleria ── */
.gallery-photos-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.gallery-photo-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: #0a0a0a;
}

.gallery-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(15%);
  transition: filter .25s, transform .25s;
}

.gallery-photo-item:hover img {
  filter: grayscale(0%);
  transform: scale(1.04);
}

.gallery-photo-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.75);
  font-family: 'Share Tech Mono', monospace;
  font-size: .80rem;
  color: rgba(255,255,255,.65);
  letter-spacing: normal;
  padding: 4px 8px;
  opacity: 0;
  transition: opacity .2s;
}

.gallery-photo-item:hover .gallery-photo-caption { opacity: 1; }

/* ── Lightbox ── */
.glightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.94);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
}

.glightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: calc(100vw - 160px);
  max-height: 90vh;
}

.glightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

.glightbox-caption {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  color: rgba(255,255,255,.6);
  letter-spacing: .05em;
  margin-top: 10px;
  text-align: center;
}

.glightbox-close {
  position: fixed;
  top: 20px; right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #2a2a2a, #0e0e0e);
  border: 2px solid rgba(255,255,255,.18);
  cursor: pointer;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: box-shadow .15s, border-color .2s;
}

.glightbox-close:hover {
  border-color: rgba(200,0,0,.5);
  box-shadow: 0 0 12px rgba(200,0,0,.2);
}

.glightbox-close svg { width: 20px; height: 20px; }

.glightbox-prev,
.glightbox-next {
  background: none;
  border: none;
  color: rgba(255,255,255,.4);
  font-size: 2rem;
  cursor: pointer;
  padding: 20px;
  transition: color .15s;
  flex-shrink: 0;
}

.glightbox-prev:hover,
.glightbox-next:hover { color: var(--white); }

/* ── Mobile ── */
@media (max-width: 700px) {
  .gallery-main { padding: 24px 16px 60px; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .gallery-photos-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; }

  /* Lightbox mobile: immagine fullwidth, frecce sovrapposte */
  .glightbox-overlay {
    flex-direction: column;
    padding: 0;
    gap: 0;
  }
  .glightbox-content {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    flex: 1;
    justify-content: center;
    position: relative;
  }
  .glightbox-content img {
    width: 100vw;
    max-width: 100vw;
    max-height: calc(100vh - 60px);
    object-fit: contain;
  }
  .glightbox-caption {
    position: fixed;
    bottom: 16px;
    left: 0; right: 0;
    text-align: center;
    font-size: .7rem;
    padding: 0 60px;
  }
  .glightbox-prev,
  .glightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1002;
    padding: 12px;
    font-size: 2rem;
    background: rgba(0,0,0,.4);
    color: rgba(255,255,255,.7);
  }
  .glightbox-prev { left: 0; }
  .glightbox-next { right: 0; }
}



@media (max-width: 700px) {
  .glightbox-prev,
  .glightbox-next {
    -webkit-appearance: none;
    appearance: none;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1002;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
    font-size: 1.2rem;
    line-height: 1;
    background: rgba(0,0,0,.55);
    color: rgba(255,255,255,.85);
    border-radius: 50% !important;
    width: 48px;
    height: 48px;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-sizing: border-box;
  }
  .glightbox-prev { left: 8px; right: auto; }
  .glightbox-next { right: 8px; left: auto; }
}
/* ── Load more ── */
.gallery-load-more-wrap {
  text-align: center;
  padding: 40px 0 20px;
}

.gallery-load-more {
  background: none;
  border: 1px solid var(--grey-dark);
  border-left: 3px solid var(--red);
  color: rgba(255,255,255,.6);
  font-family: 'Share Tech Mono', monospace;
  font-size: .75rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  padding: 10px 24px;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}

.gallery-load-more:hover {
  border-color: var(--red);
  color: var(--white);
  background: rgba(200,0,0,.08);
}

.load-more-count {
  color: var(--grey);
  font-size: .65rem;
  margin-left: 6px;
}
