*,
*::before,
*::after { box-sizing: border-box; }
main
{
 width: 100%;
height: auto;
margin: 10rem 0;
  user-select: none;
  -webkit-user-select: none; 
  -ms-user-select: none;    
}
.gallery img{
    width: 100%;
    height: auto;
    margin-bottom: 0;
    display: block;
    max-width: 100%;
    object-fit: contain;
}
.gallery
{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    padding: 2rem;
    background-color: black;
    justify-content: center;
    align-items: start;
    margin: 0 auto;
    max-width: calc(4 * 350px + 3 * 2rem);
}

.gallery-item {
  position: relative;
    transition: all 0.3s ease-in-out;
    margin: 0; 
}

.gallery-item img {
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none; /* imaginea nu primește clickuri */
  display: block;
  width: 100%;
  height: auto;
}

/* Overlay transparent care primește clickurile */
.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 2;
  cursor: pointer; /* să arate clar că e clicabil */
}
.gallery-item p
{
    color: #000000;
    background-color: white;
    text-align: center;
    font-size: 1.2rem;
    padding: 5px 0px;
    margin: 0;
    width: 100%;

}
.gallery-item:hover
{
    transform: scale(1.05);
    box-shadow: 0px 0px 30px 15px rgba(200, 30, 30, 0.192);
}

#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#lightbox.hidden {
  display: none;
}
#lightbox .backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.9);
  width: 100%;
height: 100%;
  z-index: 1;              /* sub imagine/controale */
}
#lightbox img,
#lightbox .close,
#lightbox .nav {
  z-index: 2;              /* peste backdrop */
}


#lightbox img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 6px;
  pointer-events: auto;
    pointer-events: none;        /* imaginea nu primește clickuri */
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Close button */
#lightbox .close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
}

/* Navigation arrows */
#lightbox .nav {
  position: absolute;
  background-color: transparent;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  color: #fff;
  cursor: pointer;
  user-select: none;
  padding: 0 1rem;
}
#lightbox img { cursor: default; }


#lightbox .prev { left: 1rem; }
#lightbox .next { right: 1rem; }

#lightbox .nav:hover,
#lightbox .close:hover {
  color: #A6CFD5;
}
@media only screen and (max-width: 900px) {
    
    .gallery
    {
        grid-template-columns: repeat(3,1fr);
    }
    .gallery-item p {
    font-size: 1rem;
  }
}
@media only screen and (max-width: 700px) {
    .gallery-item p {
    font-size: 1rem;
  }
    .gallery
    {
        grid-template-columns: repeat(2,1fr);
    }
}

@media only screen and (max-width: 500px) {
  .gallery-item p {
    font-size: 1rem;
  }
    .gallery
    {
        grid-template-columns: repeat(1,1fr);
    }
}
/* Lightbox responsiveness */
@media (max-width: 900px) {
  #lightbox .nav {
    font-size: 2.2rem;
    padding: 0 0.8rem;
  }

  #lightbox .close {
    font-size: 1.8rem;
    top: 0.8rem;
    right: 1rem;
  }
}

@media (max-width: 600px) {
  #lightbox .nav {
    font-size: 1.2rem;
    padding: 0 0.6rem;
    background-color: transparent;
  }

  #lightbox .close {
    font-size: 1.5rem;
    top: 0.5rem;
    right: 0.8rem;
  }

  #lightbox img {
    max-width: 95%;
    max-height: 80%;
  }
}
